QuickTime 3 defines version 1 of the SoundDescription sample description record. Note that for purposes of this discussion, a QuickTime sound sample description chunk describes the format of a collection of audio samples.
The existing description is shown in Listing 19-1 for reference.
Listing 1 The SoundDescription sample description
struct SoundDescription {
long descSize; /* total size of SoundDescription
including extra data */
long dataFormat; /* sound format */
long resvd1; /* reserved for apple use. set to zero */
short resvd2; /* reserved for apple use. set to zero */
short dataRefIndex;
short version; /* which version is this data */
short revlevel; /* what version of that codec did this */
long vendor; /* whose codec compressed this data */
short numChannels; /* number of channels of sound */
short sampleSize; /* number of bits per sample */
short compressionID; /* unused. set to zero. */
short packetSize; /* unused. set to zero. */
UnsignedFixedsampleRate; /* sample rate sound is captured at */
};
typedef struct SoundDescription SoundDescription;
The version 1 of this record includes four extra fields to store information about compression ratios. It also defines how other extensions are added to the SoundDescription.
struct SoundDescriptionV1 {
// original fields
SoundDescription desc;
// fixed compression ratio information
unsigned long samplesPerPacket;
unsigned long bytesPerPacket;
unsigned long bytesPerFrame;
unsigned long bytesPerSample;
// additional atom based fields ([long size, long type, some data],
repeat)
};
The version one sound description is a superset of the version zero sound description. The new fields are taken directly from the CompressionInfo structure currently used by the Sound Manager to describe the compression ratio of fixed ratio audio compression algorithms. They are described in detail in Inside Macintosh: Sound. If these fields are not used, they are set to zero (file readers only need to check to see if samplesPerPacket is zero). The fields have been added to support compression algorithms which can be run at different compression ratios and to support more generic parsing of QuickTime sound tracks
Important
It is necessary to know the compression ratio to rechunk/flatten the media. In the past, the only way to know the compression ratio was to directly query the audio decompressor. If this process was running on a computer without the decompressor (such as a server), it would not have enough information to correctly rechunk the audio.
All other additions to the SoundDescription are made using the traditional QuickTime Atom method. That means one or more atoms can be appended to the end of the SoundDescription using the standard [size, type] mechanism used throughout the QuickTime Movie Resource structure.
| Previous | Chapter contents | Chapter top | Section top | Next |